import requests
import json

# 测试千问模型
def test_qwen():
    url = "http://localhost:8000/qwen/invoke"
    payload = {
        "input": "你好，请用中文回答：什么是人工智能？"
    }
    headers = {"Content-Type": "application/json"}

    response = requests.post(url, data=json.dumps(payload), headers=headers)
    print("千问模型响应:", response.json())

# 测试笑话生成
def test_joke():
    url = "http://localhost:8000/joke/invoke"
    payload = {
        "input": {"topic": "科学家"}
    }
    headers = {"Content-Type": "application/json"}

    response = requests.post(url, data=json.dumps(payload), headers=headers)
    print("笑话生成响应:", response.json())

if __name__ == "__main__":
    test_qwen()
    test_joke()